#include "mystdio.h"
#include <string.h>
#define MYFILE "log.txt"

int main()
{
    MY_FILE *mf = my_fopen(MYFILE, "w");
    const char *str = "hello my name is nhy";
    int cnt = 500;
    while (cnt)
    {
        char buff[1024];
        snprintf(buff, sizeof(buff), "%s:%d\n", str, cnt--);
        size_t size = my_fwrite(buff,strlen(buff),1,mf);
        printf("当前成功写入了%d字节\n",size);
        sleep(1);
    }

    return 0;
}